﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using System.Data;
public partial class administrator_uc_admin_v_banner : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        { 
            if (!string.IsNullOrEmpty(Request.QueryString["itemid"]))
            {
                LoadDataInfo(int.Parse(Request.QueryString["itemid"].ToString().Trim()));               
            }
        }
    }
    private void LoadDataInfo(int ItemID)
    {
        DataTable dt = new BLL.CmsBLL().Banner_ViewItemByItemID(ItemID);
        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0]["FileType"].ToString().ToLower().Equals("image"))
                ltViewBanner.Text = "<img src=\"../images/" + dt.Rows[0]["FileName"].ToString() + "\" />\n";
            else
                ltViewBanner.Text = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'\n" +
                                " style='height: 62px' width='447px'>\n" +
                                " <param name='movie'\n" +
                                " value='../images/" + dt.Rows[0]["FileName"].ToString() + "' />\n" +
                                " <param name='quality' value='high' />\n" +
                                " <embed height='62 pluginspage='http://www.macromedia.com/go/getflashplayer' quality='high'\n" +
                                " src='../images/" + dt.Rows[0]["FileName"].ToString() + "' type='application/x-shockwave-flash' width='447'>\n" +
                                " </embed>\n" +
                                " </object>";
        }
        else
            lblMessageView.Text = "Load dữ liệu lỗi!";
    }   
}